package org.example;

/**
 * @author: knowno
 * @create: 2025-09-09 10:54
 * @Version 1.0
 **/
public class TestConst {
//    final int a; //类成员不能不赋值
    public static void main(String[] args) {

        final int a;
        a =10;
        System.out.println(a);
        //final修饰一个变量,表示这个变量是常量
//        final int a = 10;
//        System.out.println(a);

        //不能修改final常量的值
        //Cannot assign a value to final variable 'a'
        //a = 20;

    }
}

class T{
    final int a = 10;
    //final修饰的变量,必须在定义的时候赋值,或者在构造方法中赋值
    final int b ;
    public T(){
        b = 10;
    }
}
